package com.woniu.controller;

import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.woniu.entity.CapitalChannelEntity;
import com.woniu.entity.ClientMortgageInfo;
import com.woniu.service.ClientMortgageInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

@RestController
@RequestMapping("/clientMortgageInfo")
public class ClientMortgageInfoController {
    @Autowired
    ClientMortgageInfoService clientMortgageInfoService;

    @PreAuthorize("@ss.hasPermi('mortgageInfo:house')")
    @GetMapping("/clientMortgageInfoHouseId/{id}")
    public AjaxResult findHouseId(@PathVariable("id") Integer clientMortgageInfoId){
        ClientMortgageInfo clientMortgageInfo = clientMortgageInfoService.findHouseId(clientMortgageInfoId);
        if(Objects.nonNull(clientMortgageInfo)){
            return new AjaxResult(HttpStatus.SUCCESS,"",clientMortgageInfo);
        }else {
            return new AjaxResult(HttpStatus.SUCCESS,"查询失败",null);
        }
    }

    @PreAuthorize("@ss.hasPermi('mortgageInfo:car')")
    @GetMapping("/clientMortgageInfoCarId/{id}")
    public AjaxResult findCarId(@PathVariable("id") Integer clientMortgageInfoId){
        ClientMortgageInfo clientMortgageInfo = clientMortgageInfoService.findCarId(clientMortgageInfoId);
        if(Objects.nonNull(clientMortgageInfo)){
            return new AjaxResult(HttpStatus.SUCCESS,"",clientMortgageInfo);
        }else {
            return new AjaxResult(HttpStatus.SUCCESS,"查询失败",null);
        }
    }
}
